#{extends '/include/main.html' /}
<div class="form-page">
	<a href="@@{CommonTableController.list()}" class="form-backto-result-button">返回</a>
	<h2 class="form-title">表管理</h2>
	#{if table}
		<form action="@@{CommonTableController.update}?x-http-method-override=PUT" method="POST">
		<input type="hidden" name="tableId" value="${table.id}" />
	#{/if} 
	#{else}
		<form action="@@{CommonTableController.save}" method="POST">
	#{/else}
		<table class="form-submit-zone">
			<tbody>
				<tr>
					<th>表名</th>
					<td>
						<input type="text" name="name" value="${(flash.name || flash.name == '') ? flash.name : (table ?.name)}" />
						<div class="error"><span>#{error 'name' /}</span></div>
					</td>
				</tr>
				<tr>
					<th>维护人员</th>
					<td>
						<select name="maintainerId">
							<option value="">请选择</option>
							#{list items : maintainers, as : 'maintainer'}
								<option value="${maintainer.id}" #{if (flash.maintainerId == maintainer.id.toString()) || (table && table.maintainer.id == maintainer.id)}selected#{/if}>${maintainer.name}</option>
							#{/list}
						</select>
						<div class="error"><span>#{error 'maintainerId' /}</span></div>
					</td>
				</tr>
				<tr>
					<th>是否激活</th>
					<td>
						是:<input type="radio" name="isActive" value="true" #{if !table || table.isActive == true}checked#{/if}/>
						否:<input type="radio" name="isActive" value="false" #{if table && table.isActive == false}checked#{/if}/>
					</td>
				</tr>
				<tr>
					<th>提交</th>
					<td>
						<input type="submit" value="提交" class="form-submit-zone-submit-button"/>
					</td>
				</tr>
			</tbody>
		</table>
	</form>
</div>